﻿using System;
using System.IO;
using System.Media;
using System.Reflection;
using System.Windows.Forms;

namespace Snake_Classic
{
    public partial class MenuForm : Form
    {
        public MenuForm()
        {
            InitializeComponent();
        }
        SoundPlayer player;
        private void button1_Click(object sender, EventArgs e)
        {
            Form1 form1 = new Form1();
            form1.Show();
            Hide();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Close();
            Application.Exit();
        }

        public void PlayMusicWhenVouseHover()
        {
            string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string Filepath = Path.Combine(directory, "button.wav");
            player = new SoundPlayer(Filepath);
            player.Play();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            HightScoreForm scoreForm = new HightScoreForm();
            scoreForm.Show();
            Hide();
        }

        private void button1_MouseHover(object sender, EventArgs e)
        {
            PlayMusicWhenVouseHover();
        }

        private void button2_MouseHover(object sender, EventArgs e)
        {
            PlayMusicWhenVouseHover();
        }

        private void button4_MouseHover(object sender, EventArgs e)
        {
            PlayMusicWhenVouseHover();
        }

        private void button3_MouseHover(object sender, EventArgs e)
        {
            PlayMusicWhenVouseHover();
        }

        private void MenuForm_Load(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            Help help = new Help();
            help.ShowDialog();
        }

        private void MenuForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }
    }
}
